class Solution1 {
    public int divide(int x, int y) {
        long A = x;
        long B = y;
        boolean neg= (A>0) == (B>0);
        A= A>0 ? A : -A;
        B= B>0 ? B : -B;

        long l = 0, r = A;
        while (l < r) {
            long mid = l + ((r-l) >> 1);
            if (mid * B <= A) {
                l = mid + 1;
            } else {
                r = mid - 1;
            }
        }
        l=l*B>A ? l-1 :l;
        l= neg? l:-l;
        if (l>Integer.MAX_VALUE||l<Integer.MIN_VALUE)
            return Integer.MAX_VALUE;
        return (int)l;


    }
    public static void main(String[] args) {
        Solution1 s1=new Solution1();
        System.out.println(s1.divide(-2147483648,1));
    }

}


